<div class="page-header">
	<div class="page-title"><h3><?php echo Yii::t('app', 'Announcements setting') ?></h3></div>
</div>

<h4>Add Notice</h4>
<?php $this->renderPartial('form', array('item'=>$newItem)) ?>

<h4>Notice List</h4>
<?php $form = $this->beginWidget('CActiveForm', array(
	'id'=>'edit-form',
	'method'=>'post',
	'enableClientValidation'=>true,
)); ?>
<div class="grid-view">
<table class="table table-bordered table-hover">
	<thead>
	<tr>
		<th class="span1">ID</th>
		<th class="span2">Date</th>
		<th>Content</th>
		<th class="span2">Actions</th>
	</tr>
	</thead>
	<tbody>
	<?php $i=1; foreach($items as $item): ?>
		<?php $class = $i % 2 == 0 ? 'even' : 'odd'; ?>
		<?php $key = $item->isNewRecord ? "new_".$i : $item->id; ?>
		<tr class="<?php echo $class ?>">
			<td>
				<?php echo $item->id;?>
			</td>
			<td>
				<?php 
				if (!empty($item->created_date))
					$item->created_date = date('Y/m/d H:i', strtotime($item->created_date)); 
				?>
				<?php
				Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
				$this->widget('CJuiDateTimePicker',array(
					'model'=>$item, //Model object
					'attribute'=>'created_date', //attribute name
					'mode'=>'datetime', //use "time","date" or "datetime" (default)
					'language'=>'en-GB',
					'options'=>array(
						'showAnim'=>'fold',
						'showButtonPanel'=>true,
						'autoSize'=>true,
						'dateFormat'=>'yy-mm-dd',
						'changeMonth'=> true, 
						'changeYear'=> true,
						'width'=>'120',
						'separator'=>' ',
						// 'showOn' => 'button',
						// 'buttonImage'=> Yii::app()->theme->baseUrl.'/admin/images/icon_calendar_r.gif',
						// 'buttonImageOnly'=> true,
					),
					'htmlOptions' => array(
						'readonly'=>'readonly',
						'class'=>'',
						'name'=>"Notice[$key][created_date]",
					)
				)); ?>
				<?php echo $form->error($item, 'created_date'); ?>
			</td>
			<td>
				<?php echo $form->textField($item, 'content', array('name'=>"Notice[$key][content]", 'class'=>'span12')); ?>  
				<?php echo $form->error($item, 'content'); ?>
			</td>
			<td>
				<a title="Delete" href="<?php echo $this->createUrl('delete', array('id'=>$item->id)) ?>" class="btn_delete">
					<img src="<?php echo Yii::app()->theme->baseUrl;?>/img/delete.png">
				</a>
			</td>	
		</tr>
	<?php $i++; endforeach; ?>
	</tbody>
</table>
</div><!--//gridview -->

<p>
	<input type="hidden" name="action" value="update" />
	<input type="submit" class="btn" id="discount-submit" value="Save" />
</p><!--//button-->
<?php $this->endWidget(); ?>